package github._3y.datastructure.basic;

/**
 * @Auther DRevelation
 * @Date 2020-06-05 下午 14:38
 * @Desc
 */
public class ArithmeticOne {
    public static void main(String[] args) {
        question_01(4);
    }

    /**
     * 1-n阶乘之和
     * @param n
     * @return
     */
    private static void question_01(int n) {
        int sum = 0;
        int factorial = 1;
        for (int i = 1; i <= n; i++) {
            factorial = factorial * i;
            sum = sum + factorial;
        }
        System.out.println("1-" + n + "的阶乘和是：" + sum);
    }
}
